public class 装饰者模式 {
    public static void main(String[] args) {
        RobotDecorator robot=new RobotDecorator( new RobotImpl());
        //原功能
        robot.doSomething();
        //新功能
        robot.doSomethingElse();

    }
}
interface Robot {
    void doSomething();

}
class RobotImpl implements Robot{
    @Override
    public void doSomething() {
        System.out.println("机器人再跳舞");
    }
}

class RobotDecorator implements Robot{
private Robot robot;
 public RobotDecorator(Robot robot){
    this.robot=robot;
}

    @Override
    public void doSomething() {
        robot.doSomething();
    }
    public void doSomethingElse(){
        System.out.println("机器人在唱歌");
        robot.doSomething();
    }
}